import {
	http
} from '@/config/common.js'

export default {
	// 储存数据
	setStorage(name, data) {
		uni.setStorageSync(name, data);
	},
	//获取数据
	getStorage(name) {
		return uni.getStorageSync(name);
	},
	//删除本地存储
	removeStorage(name) {
		uni.removeStorageSync(name);
	},

	/* 跳转tab页面 */
	switchTab(url) {
		uni.switchTab({
			url: url
		});
	},

	/* 跳转某个页面 */
	navigateTo(url) {
		uni.navigateTo({
			url: url
		});
	},

	/* 关闭当前页面跳到摸个页面 */
	redirectTo(url) {
		uni.redirectTo({
			url: url
		})
	},
	user: {
		userInfo() {
			return http.get('api/user/user_info')
		},
		bills(data) {
			return http.get('api/user/bills', {
				params: data
			})
		},
		set_pay_pass(data) {
			return http.post('api/user/set_pay_pass', data)
		},
		consumer_coupon_bills() {
			return http.get('api/user/consumer_coupon_bills')
		},
		oli_bills(data) {
			return http.get('api/user/oli_bills', {
				params: data
			})
		},
		user_send_oli(data) {
			return http.post('api/user/user_send_oli', data)
		},
		qr_code(data) {
			return http.get('api/user/qr_code', {
				params: data
			})
		},
		oli_orders(data) {
			return http.get('api/user/oli_orders', data)
		},
		user_send_balance(data) {
			return http.post('api/user/user_send_balance', data)
		},
		user_spreads(data) {
			return http.get('api/user/user_spreads', data)
		},
		user_banks(data) {
			return http.get('api/user/user_banks', data)
		},
		banks(data) {
			return http.get('api/user/banks', data)
		},
		add_user_bank(data) {
			return http.post('api/user/add_user_bank', data)
		},
		delete_user_bank(data) {
			return http.post('api/user/delete_user_bank', data)
		},
		user_create_widthwal(data) {
			return http.post('api/user/user_create_widthwal', data)
		},
		bill_count(data) {
			return http.get('api/user/bill_count', data)
		},
	},
	userLogin: {
		login(data) {
			return http.post('api/user/login', data)
		}
	},
	home: {
		olis() {
			return http.get('api/user/olis')
		},
		add_oli_order(data) {
			return http.post('api/user/add_oli_order', data)
		}
	}
}